package com.session07;

public class InnerDemo {
    static int a = 10;
    int b = 20;

    void f() {
        System.out.println("我在成员⽅法f()中");
    }

    class Inner { // 定义⼀个普通成员内部类
        int c = 30;

        public void g() {
            b = 100; // 调⽤外部类的实例变量b
            f(); // 调⽤外部类的实例⽅法f()
            System.out.println(a + " " + c); // 调⽤外部类的静态成员变量a
        }
    }

    public static void main(String[] args) {
        InnerDemo out = new InnerDemo(); // 实例化⼀个InnerDemo类的对象
        Inner in = out.new Inner(); // Inner类的对象通过外部类的对象创建
        in.g();
        System.out.println(out.b);
    }
}
